Skip to content

Conversation

Jack251970
Copy link
Member

Remove plugins from global & non-global plugins when they are removed from settings

This can resolve the issue from @jjw24:

Store uninstall plugin with option set to no restart, when using the plugin's action keyword, query window seems unresponsive, e.g. remove bookmark plugin and use b balabala
pm uninstall plugin with option set to no restart, when using the plugin's action keyword, query window seems unresponsive, e.g. remove bookmark plugin and use b balabala

@Jack251970 Jack251970 added this to the 2.0.0 milestone Jul 6, 2025
@Jack251970 Jack251970 added the bug Something isn't working label Jul 6, 2025
Copy link

gitstream-cm bot commented Jul 6, 2025

🥷 Code experts: no user but you matched threshold 10

Jack251970 has most 👩‍💻 activity in the files.
Jack251970, VictoriousRaptor have most 🧠 knowledge in the files.

See details

Flow.Launcher.Core/Plugin/PluginManager.cs

Activity based on git-commit:

Jack251970
JUL 9 additions & 2 deletions
JUN 2 additions & 2 deletions
MAY 89 additions & 25 deletions
APR 73 additions & 68 deletions
MAR 42 additions & 37 deletions
FEB 276 additions & 198 deletions

Knowledge based on git-blame:
Jack251970: 34%
VictoriousRaptor: 16%

To learn more about /:\ gitStream - Visit our Docs

Copy link

gitstream-cm bot commented Jul 6, 2025

Be a legend 🏆 by adding a before and after screenshot of the changes you made, especially if they are around UI/UX.

Copy link
Contributor

coderabbitai bot commented Jul 6, 2025

Warning

Rate limit exceeded

@Jack251970 has exceeded the limit for the number of commits or files that can be reviewed per hour. Please wait 12 minutes and 52 seconds before requesting another review.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

📥 Commits

Reviewing files that changed from the base of the PR and between 5317409 and 63aca6e.

📒 Files selected for processing (1)
  • Flow.Launcher.Core/Plugin/PluginManager.cs (1 hunks)
📝 Walkthrough
## Walkthrough

The internal logic of the `UninstallPluginAsync` method in `PluginManager.cs` was updated to ensure that, during plugin uninstallation, the plugin is also removed from the `GlobalPlugins` and `NonGlobalPlugins` collections, in addition to existing removal steps.

## Changes

| File(s)                                         | Change Summary                                                                                  |
|------------------------------------------------|-----------------------------------------------------------------------------------------------|
| Flow.Launcher.Core/Plugin/PluginManager.cs      | Enhanced `UninstallPluginAsync` to remove plugins from `GlobalPlugins` and `NonGlobalPlugins`. |

## Possibly related PRs

- #3786: Modified `UninstallPluginAsync` method signature and parameter handling, related to internal plugin removal logic.
- #3219: Enhanced public `UninstallPlugin` method for deleting plugin settings and user prompts, related to plugin uninstallation flow.

## Suggested reviewers

- jjw24
- taooceros
✨ Finishing Touches
  • 📝 Generate Docstrings

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

🧹 Nitpick comments (1)
Flow.Launcher.Core/Plugin/PluginManager.cs (1)

703-710: Good fix! Consider using RemoveWhere for better performance and safety.

The logic correctly addresses the issue by removing plugins from both GlobalPlugins and NonGlobalPlugins collections during uninstallation. However, the implementation can be improved:

Apply this diff to use RemoveWhere for GlobalPlugins which is more efficient and avoids potential iteration-while-modifying issues:

-                foreach (var globalPlugin in GlobalPlugins.Where(p => p.Metadata.ID == plugin.ID))
-                {
-                    GlobalPlugins.Remove(globalPlugin);
-                }
+                GlobalPlugins.RemoveWhere(p => p.Metadata.ID == plugin.ID);

The current approach for NonGlobalPlugins is already good as it collects keys first before removing them.

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 1e9eaf5 and b85b2ec.

📒 Files selected for processing (1)
  • Flow.Launcher.Core/Plugin/PluginManager.cs (1 hunks)
🧰 Additional context used
🧠 Learnings (2)
📓 Common learnings
Learnt from: Jack251970
PR: Flow-Launcher/Flow.Launcher#3791
File: Flow.Launcher.Core/Plugin/PluginManager.cs:293-295
Timestamp: 2025-07-01T05:46:13.251Z
Learning: In Flow.Launcher.Core/Plugin/PluginManager.cs, when checking if a plugin is modified within the PluginManager class itself, prefer using the internal static PluginModified(string id) method directly rather than going through API.PluginModified() for better performance and architectural design.
Flow.Launcher.Core/Plugin/PluginManager.cs (1)
Learnt from: Jack251970
PR: Flow-Launcher/Flow.Launcher#3791
File: Flow.Launcher.Core/Plugin/PluginManager.cs:293-295
Timestamp: 2025-07-01T05:46:13.251Z
Learning: In Flow.Launcher.Core/Plugin/PluginManager.cs, when checking if a plugin is modified within the PluginManager class itself, prefer using the internal static PluginModified(string id) method directly rather than going through API.PluginModified() for better performance and architectural design.
⏰ Context from checks skipped due to timeout of 90000ms (5)
  • GitHub Check: gitStream workflow automation
  • GitHub Check: gitStream.cm
  • GitHub Check: gitStream.cm
  • GitHub Check: build
  • GitHub Check: Check Spelling

@Jack251970 Jack251970 requested a review from Copilot July 6, 2025 08:52
Copilot

This comment was marked as outdated.

@Jack251970 Jack251970 enabled auto-merge July 6, 2025 08:54
@Jack251970 Jack251970 requested a review from Copilot July 6, 2025 08:54
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

Removes stale plugin references from global and non-global collections when a plugin is uninstalled, preventing unresponsive queries for removed plugins.

  • Added removal of the plugin from GlobalPlugins
  • Added cleanup of entries in NonGlobalPlugins
Comments suppressed due to low confidence (1)

Flow.Launcher.Core/Plugin/PluginManager.cs:703

  • [nitpick] Add or update unit tests to verify that UninstallPluginAsync also removes the plugin from GlobalPlugins to prevent regressions.
                GlobalPlugins.RemoveWhere(p => p.Metadata.ID == plugin.ID);

@Jack251970 Jack251970 merged commit 1665910 into dev Jul 6, 2025
13 checks passed
@Jack251970 Jack251970 deleted the action_keyword_check branch July 6, 2025 11:57
@jjw24 jjw24 removed the 1 min review label Jul 6, 2025
@jjw24 jjw24 modified the milestones: 2.0.0, 1.20.2 Jul 13, 2025
jjw24 pushed a commit that referenced this pull request Jul 13, 2025
Remove plugins from global & non-global plugins when they are removed from settings
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants